import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SensorDeviceVO, SensorDeviceForm, SensorDeviceQuery } from '@/api/device/sensorDevice/types';

/**
 * 查询传感器设备信息列表
 * @param query
 * @returns {*}
 */

export const listSensorDevice = (query?: SensorDeviceQuery): AxiosPromise<SensorDeviceVO[]> => {
  return request({
    url: '/system/sensorDevice/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询传感器设备信息详细
 * @param id
 */
export const getSensorDevice = (id: string | number): AxiosPromise<SensorDeviceVO> => {
  return request({
    url: '/system/sensorDevice/' + id,
    method: 'get'
  });
};

/**
 * 新增传感器设备信息
 * @param data
 */
export const addSensorDevice = (data: SensorDeviceForm) => {
  return request({
    url: '/system/sensorDevice',
    method: 'post',
    data: data
  });
};

/**
 * 修改传感器设备信息
 * @param data
 */
export const updateSensorDevice = (data: SensorDeviceForm) => {
  return request({
    url: '/system/sensorDevice',
    method: 'put',
    data: data
  });
};

/**
 * 删除传感器设备信息
 * @param id
 */
export const delSensorDevice = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/sensorDevice/' + id,
    method: 'delete'
  });
};
